﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UFSoft.UBF.UI.MD.Runtime;
using UFSoft.UBF.UI.MD.Runtime.Implement;

namespace UFIDA.U9.YD.Cli.PlugUI
{
    internal class UIPlugHelper
    {
        /// <summary>
        /// UI插件报错方法
        /// 不能再UI插件中直接throw new exception
        /// 如果 保存属性 非空,在该属性上显示红点
        /// </summary>
        /// <param name="model">当前model</param>
        /// <param name="record">当前焦点行</param>
        /// <param name="attri">报错属性</param>
        /// <param name="eMsg">报错信息</param>
        public static void SetErrorMsg(IUIModel model,IUIRecord record, string attri, string eMsg)
        {
            if (record != null && !string.IsNullOrEmpty(attri))
            {
                model.ErrorMessage.SetErrorMessage(ref record, attri, eMsg);
            }
            model.ErrorMessage.SetErrorMessage(ref model, eMsg);
        }
    }
}
